Skip to content

Fix Gutenberg keyboard hide observer to handle dismissal notifications#25544

Merged
crazytonyli merged 2 commits into
mokagio/swiftlint-unneeded-parens-closure-argfrom
copilot/sub-pr-25521
May 8, 2026
Merged

Fix Gutenberg keyboard hide observer to handle dismissal notifications#25544
crazytonyli merged 2 commits into
mokagio/swiftlint-unneeded-parens-closure-argfrom
copilot/sub-pr-25521

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

This stacked PR addresses feedback from the SwiftLint follow-up thread by fixing a pre-existing observer wiring bug in GutenbergViewController. The hide observer was incorrectly subscribed to keyboard show notifications, preventing the hide path from running on keyboard dismissal.

  • Observer wiring

    • Changed keyboardHideObserver to subscribe to UIResponder.keyboardDidHideNotification instead of UIResponder.keyboardDidShowNotification.
  • Behavioral impact

    • Restores expected keyboard-dismiss handling so editor constraints can be updated when the keyboard hides.
keyboardHideObserver = NotificationCenter.default.addObserver(
    forName: UIResponder.keyboardDidHideNotification,
    object: nil,
    queue: .main
) { [weak self] notification in
    if let self, let keyboardRect = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect {
        self.keyboardFrame = keyboardRect
        self.updateConstraintsToAvoidKeyboard(frame: keyboardRect)
    }
}

@dangermattic
Copy link
Copy Markdown
Collaborator

1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

Copilot AI changed the title [WIP] [WIP] Address feedback on enabling SwiftLint rule: unneeded_parentheses_in_closure_argument Fix Gutenberg keyboard hide observer to handle dismissal notifications May 8, 2026
Copilot finished work on behalf of mokagio May 8, 2026 08:10
Copilot AI requested a review from mokagio May 8, 2026 08:10
@wpmobilebot
Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number32179
VersionPR #25544
Bundle IDcom.jetpack.alpha
Commit0cf5b6f
Installation URL746qmu4rk8qbg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot
Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number32179
VersionPR #25544
Bundle IDorg.wordpress.alpha
Commit0cf5b6f
Installation URL7282e8kbjtpd8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

}
}
keyboardHideObserver = NotificationCenter.default.addObserver(forName: UIResponder.keyboardDidShowNotification, object: nil, queue: .main) { [weak self] notification in
keyboardHideObserver = NotificationCenter.default.addObserver(forName: UIResponder.keyboardDidHideNotification, object: nil, queue: .main) { [weak self] notification in
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crazytonyli @jkmassel this makes sense to me: The hide observer should subscribe to the hide notification. But you'll sure have more context on the choices of implementation.

@mokagio mokagio marked this pull request as ready for review May 8, 2026 09:24
Copilot AI review requested due to automatic review settings May 8, 2026 09:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes keyboard dismissal handling in the Gutenberg editor by correcting a miswired notification observer so constraint updates run when the keyboard actually hides.

Changes:

  • Updated keyboardHideObserver to subscribe to UIResponder.keyboardDidHideNotification (instead of keyboardDidShowNotification).
  • Restores the keyboard-dismiss path so updateConstraintsToAvoidKeyboard is invoked on dismissal.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@crazytonyli crazytonyli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a copy-pasta error.

@crazytonyli crazytonyli merged commit 368e894 into mokagio/swiftlint-unneeded-parens-closure-arg May 8, 2026
28 checks passed
@crazytonyli crazytonyli deleted the copilot/sub-pr-25521 branch May 8, 2026 09:58
pull Bot pushed a commit to webfutureiorepo/WordPress-iOS that referenced this pull request May 13, 2026
…press-mobile#25521)

* Enable SwiftLint rule: unneeded_parentheses_in_closure_argument

Removes redundant parens around closure parameter lists.
SwiftLint --fix produced 809 changes across 240 files.
Part of the Orchard SwiftLint rollout campaign.

---

Generated with the help of Claude Code, https://claude.ai/code

Co-Authored-By: Claude Code Opus 4.7 <noreply@anthropic.com>

* Add space after capture list in two closures

Follow-up to the previous commit's SwiftLint autocorrect.
The `unneeded_parentheses_in_closure_argument` rule removed
`(media, state)` parens but did not insert a space when the
opening paren had been flush against `[weak self]`, leaving
`[weak self]media, state in`.
Restore the space for readability and style consistency.

---

Generated with the help of Claude Code, https://claude.ai/code

Co-Authored-By: Claude Code Opus 4.7 <noreply@anthropic.com>

* Fix Gutenberg keyboard hide observer to handle dismissal notifications (wordpress-mobile#25544)

* Initial plan

* Fix Gutenberg keyboard hide observer notification

Agent-Logs-Url: https://github.com/wordpress-mobile/WordPress-iOS/sessions/7c35862b-6e7d-4fd5-adde-7d42afde9eaa

Co-authored-by: mokagio <1218433+mokagio@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mokagio <1218433+mokagio@users.noreply.github.com>

---------

Co-authored-by: Claude Code Opus 4.7 <noreply@anthropic.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mokagio <1218433+mokagio@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants